package com.ydc.ln.tutorial;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

public class DateTest {
	/**
	 * 测试
	 * @throws ParseException
	 */
	@Test
	public void testDate() throws ParseException {
		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		// sf.setTimeZone(TimeZone.getTimeZone("Asia/shanghai"));
		// sf.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles"));
		String str3 = "1927-12-31 23:54:07";
		String str4 = "1927-12-31 23:54:08";
		Date sDt3 = sf.parse(str3);
		Date sDt4 = sf.parse(str4);
		long ld3 = sDt3.getTime() / 1000;
		long ld4 = sDt4.getTime() / 1000;
		System.out.println(ld3);
		System.out.println(ld4);
		System.out.println(ld4 - ld3);
	}
}
